############################################################################
# Replication file for:                                                    #
# "When Do Different Systems of Government Lead to Similar Power-Sharing?  # 
#  The Case of Government Formation"                                       #
# Author: Thiago N. Silva                                                  #
############################################################################

# Start time tracker
start.time <- Sys.time()

### Installing packages 
#install.packages(c("broom.mixed", "car", "dplyr", "MASS", ggeffects", "ggplot2","ggstance", 
#                   "ggthemes", "gridExtra", "jtools", "miceadds", "sjPlot","stargazer"))

### Loading packages
library(broom.mixed)
library(car)
library(dplyr)
library(MASS)
library(ggeffects)
library(ggplot2)
library(ggstance)
library(ggthemes)
library(gridExtra)
library(jtools)
library(miceadds)
library(sjPlot)
library(stargazer)

### Data
## Portfolio Allocation in Parliamentary Democracies 
## (Data from Warwick and Druckman 2006)
load(file="./parl_port_Warwick_Druckman_2006.Rdata")

## Portfolio Allocation in Presidential Democracies 
## (Data from Silva 2022)
load(file="./pres_port_Silva_2022.Rdata")

### Figure 1: Proportionality in Portfolio Allocation 
### in Parliamentary and Presidential Systems

## Figure 1a. Parliamentary Systems 
gamson_parl <- lm(Portfolio_Share ~ Seat_Share_Contribution, data = cabparl_final)

figure_1a <- ggplot(cabparl_final, aes(x = Seat_Share_Contribution, y = Portfolio_Share)) + 
  geom_point(aes(shape="Other Governing Parties")) +
  geom_point(data=cabparl_final[cabparl_final$Formateur==1,], aes(shape="Formateur's Party"), color="black") +
  geom_smooth(aes(x= Seat_Share_Contribution, y = Seat_Share_Contribution, linetype="Gamson's Law"), 
              col = "black", method = "lm", formula = y ~ x, se = FALSE) +
  scale_shape_manual(values = c(16, 1), name="") +
  theme_few() +
  scale_linetype_manual(values = "twodash") +
  theme(plot.title = element_text(hjust = 0.5),
        legend.text=element_text(size=9)) +
  labs(x = "Government Seat Share Contribution (%)", 
       y = "Portfolio Share (%)")  + 
  theme(legend.position="bottom", legend.direction="vertical", 
        legend.title=element_blank())


## Figure 1b. Presidential Systems 
gamson_pres <- lm(Portfolio_Share ~ Seat_Share_Contribution, data = pres_port_master)

figure_1b <- ggplot(pres_port_master, aes(x = Seat_Share_Contribution, y = Portfolio_Share)) + 
  geom_point(aes(shape="Other Governing Parties")) +
  geom_point(data=pres_port_master[pres_port_master$Formateur==1,], aes(shape="Formateur's Party"), color="black") +
  geom_smooth(aes(x= Seat_Share_Contribution, y = Seat_Share_Contribution, linetype="Gamson's Law"), 
              col = "black", method = "lm", formula = y ~ x, se = FALSE) +
  scale_shape_manual(values = c(16, 1), name="") +
  theme_few() +
  scale_linetype_manual(values = "twodash") +
  theme(plot.title = element_text(hjust = 0.5),
        legend.text=element_text(size=9)) +
  labs(x = "Government Seat Share Contribution (%)", 
       y = "Portfolio Share (%)")  + 
  theme(legend.position="bottom", legend.direction="vertical", 
        legend.title=element_blank())

## Combining Figure 1a and Figure 1b in the same Figure 1 and exporting as .pdf)
pdf("./Figure_1.pdf",
    width=10,height=6) 
grid.arrange(figure_1a, figure_1b, ncol=2)
dev.off()


### Figure 2: The Effect of Presidential Powers on the Formateur’s Portfolio Share
main_int_model <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                       President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), 
                     data=pres_port_master)

## Figure 2a. Estimates and Confidence Intervals
figure_2a <- plot_model(main_int_model, rm.terms = c("as.factor(Year)1947", 
                                                     "as.factor(Year)1950", "as.factor(Year)1951",
                                                     "as.factor(Year)1952", "as.factor(Year)1953", 
                                                     "as.factor(Year)1954", "as.factor(Year)1955", 
                                                     "as.factor(Year)1956", "as.factor(Year)1957", 
                                                     "as.factor(Year)1958", "as.factor(Year)1960", 
                                                     "as.factor(Year)1961", "as.factor(Year)1962", 
                                                     "as.factor(Year)1963", "as.factor(Year)1965", 
                                                     "as.factor(Year)1966", "as.factor(Year)1967", 
                                                     "as.factor(Year)1978", "as.factor(Year)1980", 
                                                     "as.factor(Year)1981", "as.factor(Year)1982", 
                                                     "as.factor(Year)1983", "as.factor(Year)1984", 
                                                     "as.factor(Year)1985", "as.factor(Year)1986", 
                                                     "as.factor(Year)1987", "as.factor(Year)1988", 
                                                     "as.factor(Year)1989", "as.factor(Year)1990", 
                                                     "as.factor(Year)1991", "as.factor(Year)1992", 
                                                     "as.factor(Year)1993", "as.factor(Year)1994", 
                                                     "as.factor(Year)1995", "as.factor(Year)1996", 
                                                     "as.factor(Year)1997", "as.factor(Year)1998", 
                                                     "as.factor(Year)1999", "as.factor(Year)2000", 
                                                     "as.factor(Year)2001", "as.factor(Year)2002", 
                                                     "as.factor(Year)2003", "as.factor(Year)2004", 
                                                     "as.factor(Year)2005", "as.factor(Year)2006", 
                                                     "as.factor(Year)2007", "as.factor(Year)2008", 
                                                     "as.factor(Year)2009", "as.factor(Year)2010",
                                                     "as.factor(Year)2011", "as.factor(Year)2012", 
                                                     "as.factor(Year)2013", "as.factor(Year)2014", 
                                                     "as.factor(Year)2015", "as.factor(Year)2016", 
                                                     "as.factor(Year)2017", "as.factor(Year)2018", 
                                                     "as.factor(Year)2019", "as.factor(Country)Bolivia", 
                                                     "as.factor(Country)Brazil",  "as.factor(Country)Burundi", 
                                                     "as.factor(Country)Chile", "as.factor(Country)Colombia", 
                                                     "as.factor(Country)Ecuador", "as.factor(Country)El Salvador", 
                                                     "as.factor(Country)Ghana",  "as.factor(Country)Honduras", 
                                                     "as.factor(Country)Indonesia",  "as.factor(Country)Kenya", 
                                                     "as.factor(Country)Malawi",  "as.factor(Country)Panama", 
                                                     "as.factor(Country)Paraguay",  "as.factor(Country)Peru", 
                                                     "as.factor(Country)Philippines",  "as.factor(Country)Sierra Leone", 
                                                     "as.factor(Country)Uruguay",  "as.factor(Country)Venezuela"),
                        axis.labels = c("(Intercept)", "President_Majority",  
                                        "Electoral_Year", "Formateur x Presidential Power",
                                        "Presidential Power", "Formateur",
                                        "Seat Share Contribution"), 
                        colors = "bw", show.values = TRUE, show.intercept = TRUE,
                        show.p = FALSE, order.terms = c(2, 3, 4, 7, 5, 6, 1)) +
  geom_hline(yintercept=0, lty=2, lwd=0.6, colour="black") +
  theme_bw() +
  ylab("Estimates") +   
  theme(axis.title.x = element_text(size = 12),
        axis.text.x = element_text(size = 12),
        axis.text.y = element_text(size = 11, face="bold")) + 
  theme(plot.title = element_blank())

## Figure 2b. Marginal Effects
source("./ggintfun.R")
figure_2b <- ggintfun(main_int_model, varnames = c("Formateur", "Presidential_Power"),
                      varlabs = c("Formateur on Portfolio Share", "Presidential Power" ), 
                      title = FALSE, rug = T, jitter_factor = 10,
                      twoways = F) +   
  theme(axis.title.x = element_text(size = 18),
        axis.text.x = element_text(size = 18),
        axis.title.y = element_text(size = 18),
        axis.text.y = element_text(size = 18)) + 
  theme(plot.title = element_blank())

## Combining Figure 2a and Figure 2b in the same Figure 2 
## and exporting as .pdf)
pdf("./Figure_2.pdf",
    width=12,height=6) 
grid.arrange(figure_2a, figure_2b, ncol=2)
dev.off()



#### Supplementary Material 

## Table A.1: Testing Gamson’s Law and the Formateur’s Advantage

# Model 1 of Table A.1: Gamson's Law Test in Parliamentary Systems
gamson_parl <- lm(Portfolio_Share ~ Seat_Share_Contribution, data = cabparl_final)

# Model 2 of Table A.1: Gamson's Law Test in Presidential Systems
gamson_pres <- lm(Portfolio_Share ~ Seat_Share_Contribution, data = pres_port_master)

# Model 3 of Table A.1: Formateur Advantage Test in Parliamentary Systems
Formateur_parl <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur, data = cabparl_final)

# Model 4 of Table A.1: Formateur Advantage Test in Parliamentary Systems
Formateur_pres <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur,
                     data = pres_port_master)

# Combining all models in Table A.1.
stargazer(gamson_parl, gamson_pres, Formateur_parl, Formateur_pres,
          type="text", out="./TableA1.txt")

### Table B.1: List of Countries and Years Covered
## Table B.1 generated with the information extracted from the code below:
with(subset(pres_port_master), split(Year, Country))

###Table C.1: Descriptive Statistics and Variables
stargazer(pres_port_master[c("Portfolio_Share", "Presidential_Power", "Formateur", 
                             "Seat_Share_Contribution", "Electoral_Year", "President_Majority")], 
          type = "text", digits=2, 
          summary.stat = c("mean", "sd", "min", "max", "n"),
          out="./TableC1.txt")


### Figure D.1: Distribution of Presidential Power Across Presidential Democracies
### (Average Values)
pdf("./Figure_D1.pdf",
    width=8,height=6) 
pres_port_master %>%
  distinct(Country, .keep_all = TRUE) %>% 
  ggplot(aes(x = reorder(factor(Country), Avg_Pres_Power_Country), y = Avg_Pres_Power_Country)) +
  geom_bar(stat="identity", alpha=.9, width=.8) +
  geom_hline(yintercept=0.41, linetype="dashed", color = "blue") +
  geom_text(aes(label=round(Avg_Pres_Power_Country,2)), 
            position=position_dodge(width=0.9), hjust=-0.18, size = 2.6) +  
  coord_flip() +
  xlab("Countries") +
  ylab("Mean Value of Presidential Powers") + ylim(0,0.62) +
  theme_bw()
dev.off()

### Table E.1: The Effect of Presidential Power on the Formateur’s Portfolio Share

## Model 1 of Table E.1. Benchmark model
bench <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power +
              Formateur*Presidential_Power, data=pres_port_master)

## Model 2 of Table E.1. With Controls
controls <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                 President_Majority  + Formateur*Presidential_Power, 
               data=pres_port_master)

## Model 3 of Table E.1. With Country and Year Fixed-Effects
main_int_model <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                       President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), 
                     data=pres_port_master)

## Model 4 of Table E.1. With Country, Year, and Government Fixed-Effects
model4_FE <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + 
                  Electoral_Year + President_Majority  + Formateur*Presidential_Power + 
                  as.factor(Country) + as.factor(Year) + as.factor(Coalition_ID), 
                data=pres_port_master)

## Combining Models 1-4 in Table E.1
stargazer(bench, controls, main_int_model, model4_FE,
          type="text", out="./TableE1.txt")

### Table F.1: Original Model and Model Including Single-Party Governments
load(file="./pres_single_gov_Silva_2022.Rdata")

main_int_model <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                       President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), 
                     data=pres_port_master)

single_party_model <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                           President_Majority  + Single_Party_Government + Formateur*Presidential_Power + 
                           as.factor(Country) + as.factor(Year), 
                         data=pres_single_gov)


## Combining Models in Table F.1
stargazer(main_int_model, single_party_model,
          type="text", out="./TableF1.txt")


### Figure G.1: Robustness Test: Removing One Country at a Time
arg_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Argentina"))
bol_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Bolivia"))
bra_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Brazil"))
bur_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Burundi"))
chi_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Chile"))
col_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Colombia"))
ecu_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Ecuador"))
els_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="El Salvador"))
gha_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Ghana"))
hon_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Honduras"))
ind_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Indonesia"))
ken_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Kenya"))
mal_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Malawi"))
pan_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Panama"))
par_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Paraguay"))
per_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Peru"))
phi_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Philippines"))
sie_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Sierra Leone"))
uru_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Uruguay"))
ven_mod <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year), subset(pres_port_master, Country!="Venezuela"))


pdf("./Figure_G1.pdf",
    width=8,height=6) 
plot_summs(arg_mod,
           bol_mod,
           bra_mod,
           bur_mod,
           chi_mod,
           col_mod,
           ecu_mod,
           els_mod,
           gha_mod,
           hon_mod, 
           ind_mod,
           ken_mod,
           mal_mod,
           pan_mod,
           par_mod,
           per_mod,
           phi_mod,
           sie_mod,
           uru_mod,
           ven_mod,
           coefs = c("Formateur x \n Presidential Power" = "Formateur:Presidential_Power"),
           colors = "Rainbow",
           ci_level = 0.95,
           inner_ci_level = .9,
           point.shape = FALSE, 
           model.names = unique(pres_port_master$Country),
           legend.title = "Country Removed:") + theme_few() + ylab("")
dev.off()

### Figure G.2: DFBETAS for the Estimation of the Interactive Term Between Formateur
### and Presidential Power

# Calculate DFBETAS for each observation in the model
dfbetas <- as.data.frame(dfbetas(main_int_model))

# Figure G.2 
pdf("./Figure_G2.pdf",
    width=8,height=6) 
dfbetaPlots(main_int_model, terms= "Formateur:Presidential_Power", id.n=5, xlab="N", 
            ylab="Formateur x Presidential Power")
dev.off()

### Table G.1: DFBETA: Influential Observations
# Table G.1 generated from information extracted from Figure G.2, 
# in which large values of DFBETAS are indicated, labeling observations that are
# influential in estimating the coefficient of interest.
# Obs. Country (Year) DFBETA
# 488 Kenya (2009) 0.337
# 486 Kenya (2008) 0.334
# 476 Indonesia (2013) 0.319
# 504 Malawi (2009) -0.240
# 492 Kenya 2014 -0.288

### Figure G.3: Estimate for the Interactive Term Between Formateur and Presidential
### Power in the Original Model (Model 1) and the Model Without the Identified Influential
### Observations (Model 2)
clear_df <- pres_port_master[ -c(476, 486, 488, 492, 504), ] 
df_model <- lm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + President_Majority  + 
                 Formateur*Presidential_Power + as.factor(Country) + as.factor(Year) + as.factor(Country) + as.factor(Year), 
               data=clear_df)

pdf("./Figure_G3.pdf",
    width=8,height=6) 
plot_summs(main_int_model,
           df_model,
           coefs = c("Formateur x \n Presidential Power" = "Formateur:Presidential_Power"),
           colors = "Qual1",
           ci_level = 0.95,
           inner_ci_level = .9,
           point.shape = FALSE, 
           legend.title = "") + theme_few() + ylab("")
dev.off()

### Table G.2: Comparing the Results from the Original OLS Model and the Robust Regression
robust <- rlm(Portfolio_Share ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                President_Majority  + Formateur*Presidential_Power + as.factor(Country) + as.factor(Year) + as.factor(Country) + as.factor(Year), 
              data=pres_port_master)

stargazer(main_int_model, robust, type="text", 
          out="./TableG2.txt")

### Figure H.1: Weighted Portfolio Share
### (Increasing the Importance of the Ministry of Finance)
main_int_weight2 <- lm(weight_port2 ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                         President_Majority  + Formateur*Presidential_Power +
                         as.factor(Country) + as.factor(Year), data=pres_port_master)

main_int_weight3 <- lm(weight_port3 ~ Seat_Share_Contribution + Formateur + Presidential_Power + Electoral_Year + 
                         President_Majority  + Formateur*Presidential_Power +
                         as.factor(Country) + as.factor(Year), data=pres_port_master)

pdf("./Figure_H1.pdf",
    width=7,height=5) 
plot_models(main_int_model, main_int_weight2, main_int_weight3, rm.terms = c("as.factor(Year)1947", 
                                                                             "as.factor(Year)1950", "as.factor(Year)1951",
                                                                             "as.factor(Year)1952", "as.factor(Year)1953", 
                                                                             "as.factor(Year)1954", "as.factor(Year)1955", 
                                                                             "as.factor(Year)1956", "as.factor(Year)1957", 
                                                                             "as.factor(Year)1958", "as.factor(Year)1960", 
                                                                             "as.factor(Year)1961", "as.factor(Year)1962", 
                                                                             "as.factor(Year)1963", "as.factor(Year)1965", 
                                                                             "as.factor(Year)1966", "as.factor(Year)1967", 
                                                                             "as.factor(Year)1978", "as.factor(Year)1980", 
                                                                             "as.factor(Year)1981", "as.factor(Year)1982", 
                                                                             "as.factor(Year)1983", "as.factor(Year)1984", 
                                                                             "as.factor(Year)1985", "as.factor(Year)1986", 
                                                                             "as.factor(Year)1987", "as.factor(Year)1988", 
                                                                             "as.factor(Year)1989", "as.factor(Year)1990", 
                                                                             "as.factor(Year)1991", "as.factor(Year)1992", 
                                                                             "as.factor(Year)1993", "as.factor(Year)1994", 
                                                                             "as.factor(Year)1995", "as.factor(Year)1996", 
                                                                             "as.factor(Year)1997", "as.factor(Year)1998", 
                                                                             "as.factor(Year)1999", "as.factor(Year)2000", 
                                                                             "as.factor(Year)2001", "as.factor(Year)2002", 
                                                                             "as.factor(Year)2003", "as.factor(Year)2004", 
                                                                             "as.factor(Year)2005", "as.factor(Year)2006", 
                                                                             "as.factor(Year)2007", "as.factor(Year)2008", 
                                                                             "as.factor(Year)2009", "as.factor(Year)2010",
                                                                             "as.factor(Year)2011", "as.factor(Year)2012", 
                                                                             "as.factor(Year)2013", "as.factor(Year)2014", 
                                                                             "as.factor(Year)2015", "as.factor(Year)2016", 
                                                                             "as.factor(Year)2017", "as.factor(Year)2018", 
                                                                             "as.factor(Year)2019", "as.factor(Country)Bolivia", 
                                                                             "as.factor(Country)Brazil",  "as.factor(Country)Burundi", 
                                                                             "as.factor(Country)Chile", "as.factor(Country)Colombia", 
                                                                             "as.factor(Country)Ecuador", "as.factor(Country)El Salvador", 
                                                                             "as.factor(Country)Ghana",  "as.factor(Country)Honduras", 
                                                                             "as.factor(Country)Indonesia",  "as.factor(Country)Kenya", 
                                                                             "as.factor(Country)Malawi",  "as.factor(Country)Panama", 
                                                                             "as.factor(Country)Paraguay",  "as.factor(Country)Peru", 
                                                                             "as.factor(Country)Philippines",  "as.factor(Country)Sierra Leone", 
                                                                             "as.factor(Country)Uruguay",  "as.factor(Country)Venezuela",
                                                                             "Seat_Share_Contribution",  "Formateur", "Presidential_Power", "Electoral_Year", "President_Majority"),
            colors = "Dark2", legend.title = "DV:",      
            m.labels = c("Non-Weighted Portfolio Share", "Weighted Portfolio Share (Factor 2)", "Weighted Portfolio Share (Factor 3)"),
            show.values=TRUE, 
            show.p = F, 
            axis.labels = c("Formateur x \n Presidential Power"),
            show.intercept = FALSE) +
  geom_hline(yintercept=0, lty=2, lwd=0.6, colour="black")  +
  ylab("Estimates") +   
  theme(axis.title.x = element_text(size = 12),
        axis.text.x = element_text(size = 14),
        axis.text.y = element_text(size = 11, face="bold")) + 
  theme(plot.title = element_blank()) +
  theme_bw() + theme(legend.position="bottom") +
  ylim(-.05, 0.7)
dev.off()

### Table H.1: Robustness Test: Weighted Portfolio Share
### (Increasing the Importance of the Ministry of Finance)
stargazer(main_int_weight2, main_int_weight3, type="text", 
          out="./TableH1.txt")

# End time tracker and displaying it
(time.taken <- Sys.time() - start.time)
